<template>
	<div class="body">
		<el-select v-model="dataValue" placeholder="数据集选择" style="width: 240px">
			<el-option v-for="item in dataOptions" :key="item.value" :label="item.label" :value="item.value" />
		</el-select>
		<div style="margin: 20px 0" />
		<el-select v-model="modalValue" placeholder="模型选择" style="width: 240px">
			<el-option v-for="item in modalOptions" :key="item.value" :label="item.label" :value="item.value" />
		</el-select>
		<div style="margin: 20px 0" />
		<el-input v-model="configTxt" type="input" style="max-width: 600px;" placeholder="参数配置" />
		<div style="margin: 20px 0" />
		<div class="dialog-footer">
			<el-button type="primary" :disabled="loading" @click="submitFileForm">开始训练</el-button>
		</div>
	</div>
</template>

<script lang="ts" setup name="loginLog">
import { ref, onMounted } from 'vue';
import { ElMessageBox } from 'element-plus';
// import { getBaseURL } from '/@/utils/baseUrl';
// import { Session } from '/@/utils/storage';
import { request } from '/@/utils/service';

let loading = ref(false);
const modalValue = ref('');
const dataValue = ref('');
const configTxt = ref('maxlen = 1024 batch_size = 8 epochs = 50');
const modalOptions = [
	{
		value: '1',
		label: 'IK-ERNIE-GEN',
	},
	{
		value: '2',
		label: 'IK-ERNIE-GEN-UniLM',
	}
];
const dataOptions = [
	{
		value: '1',
		label: 'lcsts_data',
	},
	{
		value: '2',
		label: '农业新闻',
	}
];

// 页面打开后获取列表数据
onMounted(() => {});

// 测试
const submitFileForm = function () {
	request({
		url: '/api/system/ai_study/config/',
		method: 'post',
		data: {
			dataValue: dataValue.value,
			modalValue: modalValue.value,
			configTxt: configTxt.value,
		},
	})
		.then((response: any) => {
			ElMessageBox.alert('配置', '保存成功', {
				confirmButtonText: '确定',
				callback: () => {},
			});
		})
		.catch(() => {
			ElMessageBox.alert('配置', '保存失败', {
				confirmButtonText: '确定',
				callback: () => {},
			});
		});
};
</script>

<style scoped lang="scss">
.body {
	margin: 15px;
	padding: 15px;
}
</style>
